home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / full / CBUILDER / SAMS / SAMPLES / CHAP04 / READFILE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-12  |  478 b   |  25 lines

  1. #include <condefs.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <iostream.h>
  5. #include <fstream.h>
  6. #include <conio.h>
  7. #pragma hdrstop
  8.  
  9. int main(int argc, char **argv)
  10. {
  11.   char buff[81];
  12.   ifstream infile;
  13.   infile.open("readfile.cpp");
  14.   if (!infile) return 0;
  15.   while (!infile.eof()) {
  16.       infile.getline(buff, sizeof(buff));
  17.     cout << buff << endl;
  18.   }
  19.   infile.close();
  20.   cout << endl << "Press any key to continue...";
  21.   getch();
  22.   return 0;
  23. }
  24.  
  25.